/* 
 * File:   Client.h
 * Author: brady
 *
 * Created on October 17, 2010, 9:16 PM
 * edited
 */

#ifndef _CLIENT_H
#define	_CLIENT_H

#include <stdio.h>
#include <iostream>
#include <netdb.h>
#include <sstream>
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
#include <arpa/inet.h>
#include <string>
#include <vector>
#include <fstream>
using namespace std;

class Client {
public:
    Client(string sock_type, int ipv);
    void Connect(string host, int port);
    void Disconnect();
    int Send(void* data, int length);
    int SendString(string msg);
    void SendFile(string fpath);
    void SendFile(string prefix, string fpath, string suffix);
    int Receive(void* buffer, int bufferSize);
    char* ReceiveNoBlock();
    void SendTo(const char* msg, string host, int port);
    char* ReceiveFromAny();

private:
    int sockType;
    int IPv;
    int sockfd;
    struct addrinfo hints, *serverInfo, *p;
    stringstream bufferStream;
    void BuildClient();

};

#endif	/* _CLIENT_H */

